package com.neuedu.elm.po;

import com.neuedu.elm.dao.IBusinessDao;
import com.neuedu.elm.dao.Impl.BusinessDaoImpl;

import java.util.Scanner;

public class Business {
    Integer businessId;
    String password;
    String businessName;
    String businessAddress;
    String businessExplain;
    Float starPrice;
    Float deliveryPrice;

    public Business(Integer businessId, String password, String businessName, String businessAddress, String businessExplain, Float starPrice, Float deliveryPrice) {
        this.businessId = businessId;
        this.password = password;
        this.businessName = businessName;
        this.businessAddress = businessAddress;
        this.businessExplain = businessExplain;
        this.starPrice = starPrice;
        this.deliveryPrice = deliveryPrice;
    }

    public Business(String password, String businessName, String businessAddress, String businessExplain, Float starPrice, Float deliveryPrice) {
        this.password = password;
        this.businessName = businessName;
        this.businessAddress = businessAddress;
        this.businessExplain = businessExplain;
        this.starPrice = starPrice;
        this.deliveryPrice = deliveryPrice;
    }

    public static void insertBusiness() {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入商家名字");
        String name = sc.next();
        System.out.println("请输入商家密码");
        String password = sc.next();
        System.out.println("请输入商家地址");
        String address = sc.next();
        System.out.println("请输入商家简介");
        String ex = sc.next();
        System.out.println("请输入起送费");
        float startPrice = sc.nextFloat();
        System.out.println("请输入配送费");
        float deliverPrice = sc.nextFloat();
        Business business = new Business(name, password, address, ex, startPrice, deliverPrice);
        IBusinessDao businessDao = new BusinessDaoImpl();
        int result = businessDao.insertBusiness(business);
        if (result != 0) {
            System.out.println("添加商家成功！");
        }
        return;
    }

    public Business() {
    }

    @Override
    public String toString() {
        return "Business{" +
                "businessId=" + businessId +
                ", password='" + password + '\'' +
                ", businessName='" + businessName + '\'' +
                ", businessAddress='" + businessAddress + '\'' +
                ", businessExplain='" + businessExplain + '\'' +
                ", starPrice=" + starPrice +
                ", deliveryPrice=" + deliveryPrice +
                '}';
    }

    public String toString1() {
        return "Business{" +
                "businessId=" + businessId + '\'' +
                ", businessName='" + businessName + '\'' +
                ", businessAddress='" + businessAddress + '\'' +
                ", businessExplain='" + businessExplain + '\'' +
                ", starPrice=" + starPrice +
                ", deliveryPrice=" + deliveryPrice +
                '}';
    }

    public Integer getBusinessId() {
        return businessId;
    }

    public void setBusinessId(Integer businessId) {
        this.businessId = businessId;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getBusinessName() {
        return businessName;
    }

    public void setBusinessName(String businessName) {
        this.businessName = businessName;
    }

    public String getBusinessAddress() {
        return businessAddress;
    }

    public void setBusinessAddress(String businessAddress) {
        this.businessAddress = businessAddress;
    }

    public String getBusinessExplain() {
        return businessExplain;
    }

    public void setBusinessExplain(String businessExplain) {
        this.businessExplain = businessExplain;
    }

    public Float getStarPrice() {
        return starPrice;
    }

    public void setStarPrice(Float starPrice) {
        this.starPrice = starPrice;
    }

    public Float getDeliveryPrice() {
        return deliveryPrice;
    }

    public void setDeliveryPrice(Float deliveryPrice) {
        this.deliveryPrice = deliveryPrice;
    }
}
